package com.mjp.learn.design.proxy.dynamicProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class MyInvokeHandler implements InvocationHandler {

    private Object object;

    public MyInvokeHandler(Object object) {
        this.object = object;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println(method.getName() + " start");
        Object o = method.invoke(object, args);
        System.out.println(method.getName() + " end");
        return o;
    }
}
